package general;

import java.io.*;
import java.util.HashMap;

public class TeamsConfigReader {

	private String configFileName; 
	
	
	public TeamsConfigReader(String teamsConfigFileName) {
		configFileName = teamsConfigFileName;
	}
	
	public HashMap getTeams() throws IOException{
		HashMap<String, String> teams = new HashMap<String, String>();
		BufferedReader reader = new BufferedReader(new FileReader(configFileName));
		
		
		for (int i=0; true; i++){			
			String teamLine = reader.readLine();
			
			if (teamLine == null)
				break;
			if (teamLine.charAt(0) == '#')
				continue;
			
			String[] tokens = teamLine.split("\t");
			if (tokens.length == 2)
				teams.put(tokens[0], tokens[1]);				
			else
				System.err.println("WARNING! Bad string #" + i);
						
		}
		
		return teams;
		
	}
	
	

}
